var layerId;
$(function(){
	$("#addTopic-button").click(function(){
		layerId=layer.open({
			title: "新增轮播图",
			area: ['1200px','700px'],
			fix:true,
			type: 2,
			content: basePath+'/banner/add.shtml'
		});
	})
})

function closeLayer(flag){
	layer.close(layerId);
	if(flag>0){
		self.location.reload(true); 
	}
}
function editFun(bannerId){
	layerId=layer.open({
		title: "修改轮播图",
		area: ['1200px','700px'],
		fix:true,
		type: 2,
		content: basePath+'/banner/edit.shtml?bannerId='+bannerId
	});
}
function deleteFun(bannerId){
	if(confirm("确认删除？")){
		 $.ajax({
	  		 url:basePath+"/banner/delete.shtml?bannerId="+bannerId,  
	  		 type:"post",
	  		 dataType:"JSON",
	  		 success:function(data){
	  			 if(data.code=="000000"){
	  				 layer.msg("操作成功");
	  				setTimeout(function(){    
						self.location.reload(true);
					}, 500);
	  			 }else{
	  				 layer.msg(data.msg);
	  			 }
	  		 }
	  	 });
	}
}
